package day6.blocking_queue_impl;

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.BlockingQueue;
import java.util.concurrent.LinkedBlockingDeque;

public class Use_BlockingQueue {
    public static void main(String[] args) throws InterruptedException {

        BlockingQueue<String> queue = new LinkedBlockingDeque<>();
        BlockingQueue<String> e = new ArrayBlockingQueue<>(3);

        e.put("1");
        e.put("2");
        e.put("3");
        e.put("4");

        String poll = queue.poll();
        System.out.println(poll);
        String take = queue.take(); // 只要队列中取不到元素，就会一直阻塞
        System.out.println("永远到达不了");
    }
}
